const mongoose = require('./db')

const ObjectId = mongoose.Schema.Types.ObjectId

const AdminSchema = new mongoose.Schema({
  username: { type: String, required: true, unique: true, index: true, display: '管理员姓名' },
  password: { type: String, required: true, display: '管理员密码' },
  operation: { type: [String], required: true, default: ['c', 'r', 'u', 'd'], display: '权限列表'},
  state: { type: Number, required: true, default: 200, display: '状态' },
}, {
  collection: 'Admin',
  timestamps: true,
})

const Admin = mongoose.model('Admin', AdminSchema)

module.exports = Admin